from llama_index.core import SimpleDirectoryReader

data_dir = 'D:/pythonRoom/llm_llama/data'
reader = SimpleDirectoryReader(
    input_dir=data_dir,  # 文件读取
    recursive=True  # 是否递归读取文件中的文件
)
documents = reader.load_data()
for doc in documents:
    print(doc.metadata)

print('加载指定的文件')
files = ["D:/pythonRoom/llm_llama/class02/p2_2_默认提示词.py",
         "D:/pythonRoom/llm_llama/data/粪土成金_张无忌的环保江湖.txt"]
reader = SimpleDirectoryReader(input_files=files)
documents2 = reader.load_data()
for doc in documents2:
    print(doc.metadata)
